//25、定义一个银行账户类（BankAccount），
// 包含账户余额（balance）属性，实现存款（deposit） 和取款（withdraw）方法。

package twentyFisth;

public class BankAccount {
    private double balance;

    public BankAccount(double initialBalance) {
        this.balance = initialBalance;
    }
    public void deposit(double amount) {
        balance += amount;
        System.out.println("存款成功，当前余额：" + balance);
    }

    public void withdraw(double amount) {
        if (amount <= balance) {
            balance -= amount;
            System.out.println("取款成功，当前余额：" + balance);
        } else {
            System.out.println("余额不足，取款失败");
        }
    }


}